using System;
using System.Windows.Forms;
using System.Drawing;

namespace HIS
{
    public class AppointmentForm : Form
    {
        private DateTimePicker dtpAppointmentTime;
        private Button btnConfirm;
        private DataGridView dgvAppointmentList;

        public AppointmentForm()
        {
            InitializeComponents();
        }

        private void InitializeComponents()
        {
            // 窗体设置
            this.Text = "诊间预约";
            this.Size = new Size(800, 600);
            this.StartPosition = FormStartPosition.CenterScreen;

            // 预约时间选择区域
            GroupBox gbAppointmentTime = new GroupBox
            {
                Text = "预约时间",
                Location = new Point(10, 10),
                Size = new Size(780, 60)
            };

            Label lblAppointmentTime = new Label
            {
                Text = "预约时间：",
                Location = new Point(10, 25),
                AutoSize = true
            };

            dtpAppointmentTime = new DateTimePicker
            {
                Location = new Point(90, 22),
                Size = new Size(200, 25),
                Format = DateTimePickerFormat.Custom,
                CustomFormat = "yyyy-MM-dd HH:mm"
            };

            btnConfirm = new Button
            {
                Text = "确认预约",
                Location = new Point(300, 22),
                Size = new Size(100, 25)
            };

            gbAppointmentTime.Controls.AddRange(new Control[] {
                lblAppointmentTime,
                dtpAppointmentTime,
                btnConfirm
            });

            // 预约记录显示区域
            GroupBox gbAppointmentList = new GroupBox
            {
                Text = "预约记录",
                Location = new Point(10, 80),
                Size = new Size(780, 480)
            };

            dgvAppointmentList = new DataGridView
            {
                Location = new Point(10, 25),
                Size = new Size(760, 445),
                AllowUserToAddRows = false,
                AllowUserToDeleteRows = false,
                ReadOnly = true,
                SelectionMode = DataGridViewSelectionMode.FullRowSelect
            };

            // 添加列
            dgvAppointmentList.Columns.AddRange(new DataGridViewColumn[] {
                new DataGridViewTextBoxColumn { Name = "预约时间", HeaderText = "预约时间", Width = 150 },
                new DataGridViewTextBoxColumn { Name = "患者姓名", HeaderText = "患者姓名", Width = 100 },
                new DataGridViewTextBoxColumn { Name = "性别", HeaderText = "性别", Width = 60 },
                new DataGridViewTextBoxColumn { Name = "年龄", HeaderText = "年龄", Width = 60 },
                new DataGridViewTextBoxColumn { Name = "联系电话", HeaderText = "联系电话", Width = 120 },
                new DataGridViewTextBoxColumn { Name = "预约状态", HeaderText = "预约状态", Width = 100 }
            });

            gbAppointmentList.Controls.Add(dgvAppointmentList);

            // 添加控件到窗体
            this.Controls.AddRange(new Control[] {
                gbAppointmentTime,
                gbAppointmentList
            });
        }
    }
} 